//
//  NetErrorStateCode.m
//  zhuchiren
//
//  Created by rainday on 15/1/29.
//  Copyright (c) 2015年 rainday. All rights reserved.
//

#import "NetErrorStateCode.h"
#import <AFNetworking.h>

@implementation NetErrorStateCode


+ (NSString *)getDescribeText:(NSError *)error{
    
    
    NSInteger stateCode = [error.userInfo[AFNetworkingOperationFailingURLResponseErrorKey] statusCode];
    

    NSString *errorText;
    switch (stateCode) {
        case 0:
            errorText = @"无法连接到服务器";
            break;
        case 401:
            errorText = @"手机号码或密码错误";
            break;
        case 404:
            errorText = @"未找到";
            break;
        case 410:
            errorText = @"手机号已注册";
            break;
            
        case 500:
            errorText = @"服务器错误";
            break;
        default:
            errorText = @"连接错误";
            break;
    }
    return errorText;
    
}
@end
